#!/usr/bin/env python
#coding=utf-8 

# 全局和局部名称的字典
def foo():
	print '\ncalling foo()...'
	aString = 'bar'
	anInt = 42
	print "foo()'s globals:", globals().keys()
	print "foo()'s locals:", locals().keys()
print "__main__'s globals:", globals().keys()
print "__main__'s locals:", locals().keys()
foo()



class InstCt(object):
	count = 0 # count 是 类属性  static
	def __init__(self): # 增加count
		InstCt.count += 1
	def __del__(self): # 减少count
		InstCt.count -= 1

	def howMany(self): # 返回count
		return InstCt.count

a = InstCt()
b = InstCt()
print a.howMany()
print b.howMany()

del b
print a.howMany()
del a
print InstCt.count


